#ifndef MESSAGE_H
#define MESSAGE_H

#include <QObject>
#include <QString>
#include <QDateTime>

//class Message : public QObject
//{
//    Q_OBJECT
//public:
//    explicit Message(QObject *parent = nullptr);

class Message
{
public:
    Message();

    enum Type {
        SINGAL_CHAT,
        GROUP_CHAT,
        FRIEND_REQUEST
    };

    static QString getMessage(QString type, QString fromId, QString toId, QString data);

    QString getMessage();

    QString fromId() const;
    void setFromId(const QString &newFromId);

    QString toId() const;
    void setToId(const QString &newToId);

    QString data() const;
    void setData(const QString &newData);

    QDateTime timestamp() const;

    Type type() const;
    QString getTypeString() const;
    void setType(const QString &newType);
    void setType(Type type);

    QString groupId() const;
    void setGroupId(const QString &newGroupId);

    void setTimestamp(const QDateTime &newTimestamp);

private:
    Type m_type;
    QString m_fromId;
    QString m_toId;
    QString m_data;
    QDateTime m_timestamp;

    QString m_groupId;
};

#endif // MESSAGE_H
